﻿using System.Collections.Generic;
using System.Collections.ObjectModel;

namespace XSerialization.Generator
{
    public interface IFileMetaInfo
    {
        /// <summary>
        /// Name of the File
        /// </summary>
        string Name { get; set; }

        /// <summary>
        /// Location of the File
        /// </summary>
        string Directory { get; set; }

        /// <summary>
        /// File NameSpace
        /// </summary>
        string NameSpace { get; set; }

        /// <summary>
        /// List of optional usings declarations
        /// </summary>
        IList<string> Usings { get; set; }

        /// <summary>
        /// List of optional interface declarations
        /// </summary>
        IList<string> Interfaces { get; set; } 

        /// <summary>
        /// Optional base declaration
        /// </summary>
        string BaseItem { get; set; }

        /// <summary>
        /// Generated "RaisePropertyChanged("PropertyName");" in Property setter
        /// </summary>
        bool GeneratedRaisePropertyChanged { get; set; }

        /// <summary>
        /// Generated "protected override void Dispose(bool disposing)" in class
        /// </summary>
        bool GeneratedDisposeMethod { get; set; }
    }

    public class FileMetaInfo : IFileMetaInfo
    {
        /// <summary>
        /// Name of the File
        /// </summary>
        public string Name { get; set; }

        /// <summary>
        /// Location of the File
        /// </summary>
        public string Directory { get; set; }

        /// <summary>
        /// File NameSpace
        /// </summary>
        public string NameSpace { get; set; }

        /// <summary>
        /// List of optional usings declarations
        /// </summary>
        public IList<string> Usings { get; set; }

        /// <summary>
        /// List of optional interface declarations
        /// </summary>
        public IList<string> Interfaces { get; set; }

        /// <summary>
        /// Optional base declaration
        /// </summary>
        public string BaseItem { get; set; }

        /// <summary>
        /// Generated "RaisePropertyChanged("PropertyName");" in Property setter
        /// </summary>
        public bool GeneratedRaisePropertyChanged { get; set; }

        /// <summary>
        /// Generated "protected override void Dispose(bool disposing)" in class
        /// </summary>
        public bool GeneratedDisposeMethod { get; set; }

        /// <summary>
        /// Selected Using Item (used by XCodeGenerator)
        /// </summary>
        public string SelectedUsing { get; set; }

        /// <summary>
        /// Selected Interface Item (used by XCodeGenerator)
        /// </summary>
        public string SelectedInterface { get; set; }

        /// <summary>
        /// Default constructor
        /// </summary>
        /// <param name="name">File Name</param>
        /// <param name="directory">File Directory</param>
        /// <param name="nameSpace">File Namespace</param>
        /// <param name="baseItem">Base Item</param>
        public FileMetaInfo(string name, string directory, string nameSpace, string baseItem)
        {
            Name = name;
            Directory = directory;
            NameSpace = nameSpace;
            BaseItem = baseItem;
            GeneratedRaisePropertyChanged = true;
            GeneratedDisposeMethod = true;
            Usings = new ObservableCollection<string>();
            Interfaces = new ObservableCollection<string>();
        }
    }
}
